home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / ASSEMBLER / EXTASM / Examples / STACK < prev    next >
Text File  |  1993-10-11  |  844b  |  17 lines

  1. #set StackSize = 1024                  ; how large stack do we want?
  2. .Start
  3.    b        Main                       ; jump over the stack
  4. .Stack_Ceiling                         ; top-of-stack
  5.    dbb      StackSize,0                ; allocate stack space here
  6. .Stack_Floor                           ; bottom-of-stack
  7. .Old_Stack  dcd   0                    ; place to store old r13
  8. .Main
  9.    str      r13,Old_Stack              ; save old r13
  10.    adr      r13,Stack_Floor            ; r13-> new stack
  11.    stmfd    r13!,{r0-r12,r14}          ; push all registers on our stack
  12. .Begin
  13.    ;        normal code                ; put your program here
  14. .End
  15.    ldmfd    r13!,{r0-r12,r14}          ; pop all registers from our stack
  16.    ldr      r13,Old_Stack              ; get old r13
  17.    movs     pc,r14                     ; return with all registers intact